Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: HUD text with shader background

  1. #1
    Senior Member nene81's Avatar
    Join Date
    Nov 2014
    Location
    Seville, SPAIN
    Posts
    180

    Default HUD text with shader background

    HI MATES !

    Please Could someone tell me how to put a gray shader behind the text with huddraw?

    example:
    Click image for larger version. 

Name:	Sin título.png 
Views:	12 
Size:	14.1 KB 
ID:	1559

    I did a basic script, but shader appears over the text and if alpha is high, text is not seen.
    Code:
    main:
    
    huddraw_align 88 right top
    huddraw_font 88 facfont-20
    huddraw_rect 88 -24 222 100 14
    huddraw_color 88 1 1 1
    huddraw_alpha 88 1.0
    huddraw_string 88 ("hello")
    
    huddraw_virtualsize 89 0
    huddraw_alpha 89 0.5
    huddraw_align 89 right top
    huddraw_rect 89 -83 58 79 180
    huddraw_shader 89 "textures/mohmenu/black.tga"
    
    end
    I have tested changing the sequence (first the shader and then the text) but it is the same.

    Thanks in advance.

  2. #2
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Don't change the sequence, change the indices. The shader element should have an index that is smaller than your text for this to work.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  3. #3
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    Quote Originally Posted by Sor View Post
    Don't change the sequence, change the indices. The shader element should have an index that is smaller than your text for this to work.
    Lol I thought of that but didn't have an evidence, nene should be like "that's easy"

  4. #4
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Well you could compare the element indices to the z-index in CSS.
    It determines the stack order of an element. An element with a greater stack order will always be drawn on top of elements of a lower stack order.
    So the element with index 0 will appear behind all other elements and the element with index 255 will always appear in front of all other elements.

    EDIT: Just a reminder that using the patch elements 0 - 4 are reserved and must not be used.
    Last edited by Sor; March 19th, 2016 at 09:07 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  5. #5
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    wait, CSS ? that's in mohaa ?

  6. #6
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    No, it's just a comparison I made.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  7. #7
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    Lol then that's a bad example , you could just say "element with a greater value comes first".

  8. #8
    Senior Member nene81's Avatar
    Join Date
    Nov 2014
    Location
    Seville, SPAIN
    Posts
    180

    Default

    Thanks a lot Sor!

  9. #9
    Senior Member Ancient Order's Avatar
    Join Date
    Aug 2015
    Location
    Paris, Fr.
    Posts
    161

    Default

    For the above "comparison" to be understood, z order refers to the z axis in the (x, y, z) coordinate system and stands for the depth dimension.

  10. #10
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    Depth ? Guess it's called farplane and nearplane etc.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •